package com.richman.hgps38;

import java.text.SimpleDateFormat;

import com.richman.controller.DaShui;
import com.richman.hg.HGManager;
import com.richman.ps38.PS38GrabThread;
import com.richman.utils.MailManager;

public class HGPS38MergeThread extends Thread {

	
	public boolean sendalready = false;
	
	@Override
    public void run() {
		
		
		SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");// 设置日期格式

		try{

			while(DaShui.bStartEngine){
				try{
					
					DaShui.isnps38EventManager.constructisnps38events();
					
					Thread.sleep(500);
					
					
					if(System.currentTimeMillis() - PS38GrabThread.refreshTime > 100*1000 ) {
						//MailManager.sendMail("240749322@qq.com", "240749322", "beaqekgmzscocbab", "tongjigujinlong@126.com", "打水挂机", "服务器数据120秒未更新，请重启主机！！！！");
						//sendalready = true;
						
						System.out.println(df.format(System.currentTimeMillis()) + ":" + "ps38间隔太久未更新,擦擦擦");
						
						
//						if(DaShui.ps38GrabThread != null) {
//							DaShui.ps38GrabThread.interrupt();
//						}
//						
//						
						PS38GrabThread.refreshTime = System.currentTimeMillis();
						
					}
					
					
				}catch(Exception e){
					e.printStackTrace();
					Thread.sleep(2000);
				}
				

			}

		}catch(Exception e){
			e.printStackTrace();
		}	
	}
}
